/**
 * @(#)Main.java 2011-8-24 Copyright 2011 it.kedacom.com, Inc. All rights
 *               reserved.
 */

package com.kedacom.xmpp.demo.oneserver.chat;

import java.util.ArrayList;
import java.util.List;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smackx.packet.MultipleAddresses;

public class XmppJavaMulticast31 {

	public static String jids = "linfangfa#kedacom.com@kedacom.dev,qianmingzhao#kedacom.com@kedacom.dev,huangduo#kedacom.com@kedacom.dev,huangchunhua#kedacom.com@kedacom.dev,liangzuo#kedacom.com@kedacom.dev,tanxiaodong#kedacom.com@kedacom.dev,wangxiangke#kedacom.com@kedacom.dev,laihongping#kedacom.com@kedacom.dev,zhaoxuewei#kedacom.com@kedacom.dev,zhaolin#kedacom.com@kedacom.dev,zhoujiangguan#kedacom.com@kedacom.dev,linyuanzhou#kedacom.com@kedacom.dev,wangrui#kedacom.com@kedacom.dev,fuyou#kedacom.com@kedacom.dev,renyang#kedacom.com@kedacom.dev,chenhong#kedacom.com@kedacom.dev,sangzhiqiang#kedacom.com@kedacom.dev,wangxinxin1#kedacom.com@kedacom.dev,liangjiaohong#kedacom.com@kedacom.dev,fanhuafeng#kedacom.com@kedacom.dev,dongyuanhua#kedacom.com@kedacom.dev,zhangyang#kedacom.com@kedacom.dev,zhoudengxiang#kedacom.com@kedacom.dev,yuxiaotian#kedacom.com@kedacom.dev,sunhao#kedacom.com@kedacom.dev,yuanjianchun#kedacom.com@kedacom.dev,fanjiangen#kedacom.com@kedacom.dev,likaihong#kedacom.com@kedacom.dev,zuojiayong#kedacom.com@kedacom.dev,xutao#kedacom.com@kedacom.dev,songningning#kedacom.com@kedacom.dev,panyuwen#kedacom.com@kedacom.dev,zhukongfei#kedacom.com@kedacom.dev,miaoyaluo#kedacom.com@kedacom.dev,wangyunhui#kedacom.com@kedacom.dev,yuyonghui#kedacom.com@kedacom.dev,shenbiao#kedacom.com@kedacom.dev,zhangdongliang#kedacom.com@kedacom.dev,peizhanhong#kedacom.com@kedacom.dev,zhaoyu#kedacom.com@kedacom.dev,sunxiao#kedacom.com@kedacom.dev,liguoqiang#kedacom.com@kedacom.dev,wangqihong#kedacom.com@kedacom.dev,yaojianhua#kedacom.com@kedacom.dev,zhaoweiqiang#kedacom.com@kedacom.dev,lvzhijun#kedacom.com@kedacom.dev,zhouyumei#kedacom.com@kedacom.dev,wang.gang#kedacom.com@kedacom.dev,zhangkaixuan#kedacom.com@kedacom.dev,fuzhihao#kedacom.com@kedacom.dev,canglulu#kedacom.com@kedacom.dev,zengzhaoming#kedacom.com@kedacom.dev,zhangweifeng#kedacom.com@kedacom.dev,zhangsongjie#kedacom.com@kedacom.dev,zhaohui#kedacom.com@kedacom.dev,qianweixiang#kedacom.com@kedacom.dev,fanrong#kedacom.com@kedacom.dev,xuguanghui#kedacom.com@kedacom.dev,liangzhenzhen#kedacom.com@kedacom.dev,yaopei#kedacom.com@kedacom.dev,songsiyu#kedacom.com@kedacom.dev,chenbin#kedacom.com@kedacom.dev,yuanmingze#kedacom.com@kedacom.dev,jiangruomin#kedacom.com@kedacom.dev,dingyafeng#kedacom.com@kedacom.dev,shangzhanyu#kedacom.com@kedacom.dev,xuhongsi#kedacom.com@kedacom.dev,wangyini#kedacom.com@kedacom.dev,huangsanping#kedacom.com@kedacom.dev,guxu#kedacom.com@kedacom.dev,lujishun#kedacom.com@kedacom.dev,zhangliuqing#kedacom.com@kedacom.dev,lilie#kedacom.com@kedacom.dev,zhangqunqun#kedacom.com@kedacom.dev,zhangjiannan#kedacom.com@kedacom.dev,chengyuying#kedacom.com@kedacom.dev,caizhenhua#kedacom.com@kedacom.dev,longwei#kedacom.com@kedacom.dev,xiaojihua#kedacom.com@kedacom.dev,hubaojian#kedacom.com@kedacom.dev,jiangxin#kedacom.com@kedacom.dev,baoyang#kedacom.com@kedacom.dev,tuwenbin#kedacom.com@kedacom.dev,sunbin#kedacom.com@kedacom.dev,tangxingbo#kedacom.com@kedacom.dev,hengxiangzhong#kedacom.com@kedacom.dev,lenghui#kedacom.com@kedacom.dev,fuchongjian#kedacom.com@kedacom.dev,nizhijun#kedacom.com@kedacom.dev,yuwenying#kedacom.com@kedacom.dev,songchang#kedacom.com@kedacom.dev,youjinrui#kedacom.com@kedacom.dev,liu_yong#kedacom.com@kedacom.dev,wangzinan#kedacom.com@kedacom.dev,dengzhaohui#kedacom.com@kedacom.dev,luodongli#kedacom.com@kedacom.dev,yuyiyi#kedacom.com@kedacom.dev,chengxuxian#kedacom.com@kedacom.dev,xu.jun#kedacom.com@kedacom.dev,wenwen#kedacom.com@kedacom.dev,zhangcui#kedacom.com@kedacom.dev,zhoubo#kedacom.com@kedacom.dev,yuweiguang#kedacom.com@kedacom.dev,puhongchun#kedacom.com@kedacom.dev,shenjia#kedacom.com@kedacom.dev,luhuipeng#kedacom.com@kedacom.dev,sunxiaoxia#kedacom.com@kedacom.dev,sunfei#kedacom.com@kedacom.dev,yeqing#kedacom.com@kedacom.dev,sunyangxi#kedacom.com@kedacom.dev,zhaodefang#kedacom.com@kedacom.dev,zhangminjue#kedacom.com@kedacom.dev,zengxiaoai#kedacom.com@kedacom.dev,pengjie#kedacom.com@kedacom.dev,lizhen#kedacom.com@kedacom.dev,guojunwei#kedacom.com@kedacom.dev,chaibiao#kedacom.com@kedacom.dev,yuyonghua#kedacom.com@kedacom.dev,zhouaimin#kedacom.com@kedacom.dev,wanglifei#kedacom.com@kedacom.dev,xiaruixue#kedacom.com@kedacom.dev,lishenghui#kedacom.com@kedacom.dev,chenwencan#kedacom.com@kedacom.dev,zhangyuanfu#kedacom.com@kedacom.dev,zhuzhihui#kedacom.com@kedacom.dev,sunxiaolei#kedacom.com@kedacom.dev,chenhailiang#kedacom.com@kedacom.dev,luojunqiang#kedacom.com@kedacom.dev,wangquanlong#kedacom.com@kedacom.dev,xiahaitao#kedacom.com@kedacom.dev,yinxiaofeng#kedacom.com@kedacom.dev,daiwanli#kedacom.com@kedacom.dev,yangbaimei#kedacom.com@kedacom.dev,chenpei#kedacom.com@kedacom.dev,chengchen#kedacom.com@kedacom.dev,zhangjinfeng#kedacom.com@kedacom.dev,jiangyueying#kedacom.com@kedacom.dev,zhuhui#kedacom.com@kedacom.dev,lisong#kedacom.com@kedacom.dev,qinzhimin#kedacom.com@kedacom.dev,lishizhe#kedacom.com@kedacom.dev,lilimin#kedacom.com@kedacom.dev,haoxianbo#kedacom.com@kedacom.dev,gongsuyan#kedacom.com@kedacom.dev,gongxiaofeng#kedacom.com@kedacom.dev,chendaiwei#kedacom.com@kedacom.dev,zhujinqi#kedacom.com@kedacom.dev,tangzhixin#kedacom.com@kedacom.dev,danielwang#sg.kedacom.com@kedacom.dev,guoguangan#kedacom.com@kedacom.dev,huangweihua#kedacom.com@kedacom.dev,lixuesong#kedacom.com@kedacom.dev,luaisong#kedacom.com@kedacom.dev,zhongzhao#kedacom.com@kedacom.dev,sunchangyu#kedacom.com@kedacom.dev,nizhijun#kedacom.com@kedacom.dev,liuxiangquan#kedacom.com@kedacom.dev,yanghaoran#kedacom.com@kedacom.dev,hucongying#kedacom.com@kedacom.dev,yixiangjie#kedacom.com@kedacom.dev,xielei#kedacom.com@kedacom.dev,shiwenjuan#kedacom.com@kedacom.dev,wensi#kedacom.com@kedacom.dev,xielingling#kedacom.com@kedacom.dev,chaibiao#kedacom.com@kedacom.dev,gaolei#kedacom.com@kedacom.dev,xiaojinghai#kedacom.com@kedacom.dev,zouwengang#kedacom.com@kedacom.dev,zhaoliangchen#kedacom.com@kedacom.dev,wangyuxiang#kedacom.com@kedacom.dev,kangyan#kedacom.com@kedacom.dev,lixiaojuan#kedacom.com@kedacom.dev,caiweiming#kedacom.com@kedacom.dev,xuwenli#kedacom.com@kedacom.dev,zhangyongqing#kedacom.com@kedacom.dev,houchao#kedacom.com@kedacom.dev,mengxianqing#kedacom.com@kedacom.dev,lijianzhi#kedacom.com@kedacom.dev,libo#kedacom.com@kedacom.dev,tianliping#kedacom.com@kedacom.dev,zhangshaohua#kedacom.com@kedacom.dev,luhuipeng#kedacom.com@kedacom.dev,jiazhaojie#kedacom.com@kedacom.dev,gongtianyu#kedacom.com@kedacom.dev,lishanjun#kedacom.com@kedacom.dev,yangzhengbing#kedacom.com@kedacom.dev,dongweiquan#kedacom.com@kedacom.dev,yuweiguang#kedacom.com@kedacom.dev,fuyou#kedacom.com@kedacom.dev,yeshufang#kedacom.com@kedacom.dev,hurui#kedacom.com@kedacom.dev,bihenghu#kedacom.com@kedacom.dev,chenwen#kedacom.com@kedacom.dev,yangligeng#kedacom.com@kedacom.dev,zhaoguodong#kedacom.com@kedacom.dev,geshuanlun#kedacom.com@kedacom.dev,zhangzhishuang#kedacom.com@kedacom.dev,wangdongyue#kedacom.com@kedacom.dev,jiangjunyi#kedacom.com@kedacom.dev,luaisong#kedacom.com@kedacom.dev,wulei#kedacom.com@kedacom.dev,yuanxiaoling#kedacom.com@kedacom.dev,zhaoxiaolei#kedacom.com@kedacom.dev,yanzhanpeng#kedacom.com@kedacom.dev,lishizhe#kedacom.com@kedacom.dev,linan#kedacom.com@kedacom.dev,sunchao1#kedacom.com@kedacom.dev,zhengxiangying#kedacom.com@kedacom.dev,zhang_hui#kedacom.com@kedacom.dev,wangjinquan#kedacom.com@kedacom.dev,gongerlang#kedacom.com@kedacom.dev,xiezhiyuan#kedacom.com@kedacom.dev,liliming#kedacom.com@kedacom.dev,yaoshizhong#kedacom.com@kedacom.dev,anjunfeng#kedacom.com@kedacom.dev,hanchenqiu#kedacom.com@kedacom.dev,lihongchao#kedacom.com@kedacom.dev,zhumeilong#kedacom.com@kedacom.dev,congpeixia#kedacom.com@kedacom.dev,lilin#kedacom.com@kedacom.dev,liangli#kedacom.com@kedacom.dev,wangjun2#kedacom.com@kedacom.dev,chengming#kedacom.com@kedacom.dev,huangchunhua#kedacom.com@kedacom.dev,zoujunlong#kedacom.com@kedacom.dev,baoyang#kedacom.com@kedacom.dev,luohongbin#kedacom.com@kedacom.dev,lvshengxia#kedacom.com@kedacom.dev,panliping#kedacom.com@kedacom.dev,zengxiaoai#kedacom.com@kedacom.dev,shenweiping#kedacom.com@kedacom.dev,dengzhitao#kedacom.com@kedacom.dev,qiaoyunlei#kedacom.com@kedacom.dev,guoyulong#kedacom.com@kedacom.dev,caijianguo#kedacom.com@kedacom.dev,chenjianhong#kedacom.com@kedacom.dev,liujigang#kedacom.com@kedacom.dev,duanzhifei#kedacom.com@kedacom.dev,quewenjie#kedacom.com@kedacom.dev,yesitao#kedacom.com@kedacom.dev,lulifang#kedacom.com@kedacom.dev,zhangkaixuan#kedacom.com@kedacom.dev,daiyinan#kedacom.com@kedacom.dev,chengxuxian#kedacom.com@kedacom.dev,zhanglihua#kedacom.com@kedacom.dev,guoyang#kedacom.com@kedacom.dev,zhongtingjun#kedacom.com@kedacom.dev,lihuazhou#kedacom.com@kedacom.dev,yulei#kedacom.com@kedacom.dev,zhaoqingqing#kedacom.com@kedacom.dev,gaobiwu#kedacom.com@kedacom.dev,wangyudong#kedacom.com@kedacom.dev,wangminyu#kedacom.com@kedacom.dev,hankang#kedacom.com@kedacom.dev,zhangyansh#kedacom.com@kedacom.dev,wuyingnan#kedacom.com@kedacom.dev,zhoushuqiang#kedacom.com@kedacom.dev,zhangshasha#kedacom.com@kedacom.dev,ningheng#kedacom.com@kedacom.dev,loufengyong#kedacom.com@kedacom.dev,lidazhen#kedacom.com@kedacom.dev,xiechao#kedacom.com@kedacom.dev,zhoujiangguan#kedacom.com@kedacom.dev,shengfeng#kedacom.com@kedacom.dev,liujunjun#kedacom.com@kedacom.dev,guanwei#kedacom.com@kedacom.dev,yangchi#kedacom.com@kedacom.dev,zhangzhenyang#kedacom.com@kedacom.dev,guojunwei#kedacom.com@kedacom.dev,lihui#kedacom.com@kedacom.dev,lijiwen#kedacom.com@kedacom.dev,zhangwenjun#kedacom.com@kedacom.dev,huangqinghong#kedacom.com@kedacom.dev,yanhongming#kedacom.com@kedacom.dev,yaojie#kedacom.com@kedacom.dev,huzhengjun#kedacom.com@kedacom.dev,yichangpeng#kedacom.com@kedacom.dev,liudeyin#kedacom.com@kedacom.dev,hanbingrong#kedacom.com@kedacom.dev,tangxiang#kedacom.com@kedacom.dev,yaolinlin#kedacom.com@kedacom.dev,sunyanchen#kedacom.com@kedacom.dev,gudongwei#kedacom.com@kedacom.dev,chengyaping#kedacom.com@kedacom.dev,qianfeng#kedacom.com@kedacom.dev,chenxiaohua#kedacom.com@kedacom.dev,zhangmaolong#kedacom.com@kedacom.dev,xuying#kedacom.com@kedacom.dev,yaopeng#kedacom.com@kedacom.dev,zhengjianan#kedacom.com@kedacom.dev,lijiawen#kedacom.com@kedacom.dev,fengyuze#kedacom.com@kedacom.dev,xuming#kedacom.com@kedacom.dev,li_yang#kedacom.com@kedacom.dev,jiangruomin#kedacom.com@kedacom.dev,li_jian#kedacom.com@kedacom.dev,liguoqiang#kedacom.com@kedacom.dev,xujun#kedacom.com@kedacom.dev,wuxiaoduo#kedacom.com@kedacom.dev,hesihai#kedacom.com@kedacom.dev,maojing#kedacom.com@kedacom.dev,fangbo#kedacom.com@kedacom.dev,zhouhaiyang#kedacom.com@kedacom.dev,zhuxuefang#kedacom.com@kedacom.dev,wuwei#kedacom.com@kedacom.dev,gengchengdong#kedacom.com@kedacom.dev,yxzxkhjlb#kedacom.com@kedacom.dev,xiayong#kedacom.com@kedacom.dev,wangxiaohui#kedacom.com@kedacom.dev,zouwenyi#kedacom.com@kedacom.dev,sunjinfeng#kedacom.com@kedacom.dev,peizhanhong#kedacom.com@kedacom.dev,luomingjing#kedacom.com@kedacom.dev,sunlu#kedacom.com@kedacom.dev,zenglinggu#kedacom.com@kedacom.dev,wangting#kedacom.com@kedacom.dev";

	public static void main(String[] args) throws XMPPException, InterruptedException {
		String SERVER = "kedacom.dev", USER = "kedacom_admin_xmpp", PASS = "itserver";

		// 登录
		XMPPConnection conn = new XMPPConnection(new ConnectionConfiguration("172.16.3.31", 5222, SERVER));
		conn.connect();
		conn.login(USER, PASS, null);
		System.out.println("admin已登录!");

		conn.addPacketListener(new PacketListener() {

			// 监听包 in
			public void processPacket(Packet packet) {
				System.out.println("<--	" + packet.toXML());
			}

		}, null);
		conn.addPacketSendingListener(new PacketListener() {

			// 监听包 out
			public void processPacket(Packet packet) {
				System.out.println("-->	" + packet.toXML());
			}

		}, null);
		String msg = "消息生成时间：";
		List<String> jids = getJids();
		for (int a = 0; a < 15; a++) {
			// 组播发信息
			Message mess = new Message();
			MultipleAddresses address = new MultipleAddresses();

			for (String jid : jids) {
				address.addAddress(MultipleAddresses.TO, jid, null, null, false, null);
			}

			mess.addExtension(address);
			mess.setBody(msg);
			mess.setTo("multicast." + SERVER);
			mess.setFrom(USER + "@" + SERVER);
			conn.sendPacket(mess);
			Thread.sleep(1000);
		}

		Thread.currentThread().suspend();
	}

	public static List<String> getJids() {
		String jidArr[] = jids.split(",");
		List<String> jids = new ArrayList<String>();
		for (String jid : jidArr) {
			jids.add(jid);
		}

		return jids;
	}

}
